<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class PengeluaranObatModel extends zulModel{

	function __construct(){
			parent::__construct();
			$this->table_name	= "resep";
			$this->primary_key	= "ID_PENGELUARAN";
			$this->order_by		= "resep.ID_PENGELUARAN ASC";
			// $this->relations	= $this->relations();
	}
	function gridPengeluaranObat(){
		$this->db->select('ID_PENGELUARAN,NO_RESEP,JENIS,TGL_RESEP,NAMA_PASIEN,KETERANGAN');
		$this->db->from('resep');
		$this->db->join("pasien","resep.ID_PASIEN=pasien.ID_PASIEN");
		$this->flexigrid->build_query();
		$return['records'] = $this->db->get();
		
		$this->db->select('ID_PENGELUARAN,NO_RESEP,JENIS,TGL_RESEP,NAMA_PASIEN,KETERANGAN');
		$this->db->from('resep');
		$this->db->join("pasien","resep.ID_PASIEN=pasien.ID_PASIEN");
		$this->flexigrid->build_query(FALSE);
		$return['record_count'] = $this->db->count_all_results();

		return $return;
	}
	function get_group($val,$key){
		$this->db->select("*");
		$this->db->where($val);
		$this->db->group_by($key);
		return $this->db->get($this->table_name)->result_array();
	}
	// function relations(){
		// $relations	= array(
						// array("materi"=>array("pemesanan",array("ID_MATERI"=>"ID_MATERI"),"master_materi")),
						// array("peserta"=>array("pemesanan",array("ID_ANGGOTA"=>"ID_ANGGOTA"),"master_peserta")),
						// array("history_harga"=>array("pemesanan",array("ID_HISTORY"=>"ID_HISTORY"),"history_harga")),
					// );
		// return $relations;
	// }
}
?>